import Vue from 'vue'
import Vuex from 'vuex'
const RongIMLib = require('../utils/RongIMLib-3.0.7.2-dev.min.js')

export default new Vuex.Store({
	state: {
		rongYunIM: null
	},
	
	mutations: {
		
		rongYunInit(state) {
			
			if (!state.rongYunIM) {
				state.rongYunIM = RongIMLib.init({ appkey: 'x18ywvqfx4c1c' })
			}
			
			state.rongYunIM.watch({
				
				message (event) {
					const message = event.message
					console.log(message)
				}
				
			})
			
		}
		
	}
})